import config


class ApproveTrustAPI:

    # 认证接口
    @classmethod
    def approve(cls, session, body):
        url = config.Host + "/member/realname/approverealname"
        resp = session.post(url=url,  data=body,files={"x":"y"})
        return resp

    # 查询认证接口
    @classmethod
    def approve_status(cls, session):
        url = config.Host + "/member/member/getapprove"
        resp = session.post(url=url)
        return resp

    # 后台开户
    @classmethod
    def trust(cls, session):
        url = config.Host + "/trust/trust/register"
        resp = session.post(url)
        return resp

    # 获取充值验证码
    @classmethod
    def get_image_code(cls, session, r):
        url = config.Host + f"/common/public/verifycode/{r}"
        resp = session.get(url)
        return resp

    # 充值接口
    @classmethod
    def recharge(cls, session, image_code):
        url = config.Host + "/trust/trust/recharge"
        header = {"Content-Type": "application/x-www-form-urlencoded"}
        body = {"paymentType": "chinapnrTrust", "amount": "100", "formStr": "reForm", "valicode": image_code}
        resp = session.post(url=url, headers=header, data=body)
        return resp
